Optimal. Leaf size=84 \[ \frac{2 a \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (c+d x)\right )+b}{\sqrt{a^2-b^2}}\right )}{b^2 d \sqrt{a^2-b^2}}-\frac{\cos (c+d x)}{b d (a+b \sin (c+d x))}-\frac{x}{b^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.110158, antiderivative size = 84, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.238, Rules used = {2693, 2735, 2660, 618, 204} \[ \frac{2 a \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (c+d x)\right )+b}{\sqrt{a^2-b^2}}\right )}{b^2 d \sqrt{a^2-b^2}}-\frac{\cos (c+d x)}{b d (a+b \sin (c+d x))}-\frac{x}{b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2693
Rule 2735
Rule 2660
Rule 618
Rule 204
Rubi steps
\begin{align*} \int \frac{\cos ^2(c+d x)}{(a+b \sin (c+d x))^2} \, dx &=-\frac{\cos (c+d x)}{b d (a+b \sin (c+d x))}-\frac{\int \frac{\sin (c+d x)}{a+b \sin (c+d x)} \, dx}{b}\\ &=-\frac{x}{b^2}-\frac{\cos (c+d x)}{b d (a+b \sin (c+d x))}+\frac{a \int \frac{1}{a+b \sin (c+d x)} \, dx}{b^2}\\ &=-\frac{x}{b^2}-\frac{\cos (c+d x)}{b d (a+b \sin (c+d x))}+\frac{(2 a) \operatorname{Subst}\left (\int \frac{1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{b^2 d}\\ &=-\frac{x}{b^2}-\frac{\cos (c+d x)}{b d (a+b \sin (c+d x))}-\frac{(4 a) \operatorname{Subst}\left (\int \frac{1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac{1}{2} (c+d x)\right )\right )}{b^2 d}\\ &=-\frac{x}{b^2}+\frac{2 a \tan ^{-1}\left (\frac{b+a \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a^2-b^2}}\right )}{b^2 \sqrt{a^2-b^2} d}-\frac{\cos (c+d x)}{b d (a+b \sin (c+d x))}\\ \end{align*}
Mathematica [B] time = 5.30223, size = 494, normalized size = 5.88 \[ \frac{\cos (c+d x) \left (\sqrt{a+b} \left (\sqrt{a-b} \sqrt{1-\sin (c+d x)} \left (b \left (b^2-a^2\right ) \sqrt{-\frac{b (\sin (c+d x)-1)}{a+b}} \sqrt{\frac{b (\sin (c+d x)+1)}{b-a}}+2 a \left (a \sqrt{-b^2}+\sqrt{-b} b^{3/2} \sin (c+d x)\right ) \tan ^{-1}\left (\frac{\sqrt{b} \sqrt{\frac{b (\sin (c+d x)+1)}{b-a}}}{\sqrt{-b} \sqrt{-\frac{b (\sin (c+d x)-1)}{a+b}}}\right )\right )+2 \sqrt{-\frac{b (\sin (c+d x)-1)}{a+b}} \left (a \left (a \sqrt{-b} \sqrt{-b^2}+b^{5/2}\right )-b^2 \left (a \sqrt{b}+\sqrt{-b} \sqrt{-b^2}\right ) \sin (c+d x)\right ) \sinh ^{-1}\left (\frac{\sqrt{a-b} \sqrt{-\frac{b (\sin (c+d x)+1)}{a-b}}}{\sqrt{2} \sqrt{b}}\right )\right )-2 a b (a-b) \sqrt{1-\sin (c+d x)} (a+b \sin (c+d x)) \tanh ^{-1}\left (\frac{\sqrt{a-b} \sqrt{-\frac{b (\sin (c+d x)+1)}{a-b}}}{\sqrt{a+b} \sqrt{-\frac{b (\sin (c+d x)-1)}{a+b}}}\right )\right )}{b^2 d (a-b)^{3/2} (a+b)^{3/2} \sqrt{1-\sin (c+d x)} \sqrt{-\frac{b (\sin (c+d x)-1)}{a+b}} \sqrt{-\frac{b (\sin (c+d x)+1)}{a-b}} (a+b \sin (c+d x))} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.072, size = 153, normalized size = 1.8 \begin{align*} -2\,{\frac{\arctan \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) }{d{b}^{2}}}-2\,{\frac{\tan \left ( 1/2\,dx+c/2 \right ) }{d \left ( \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) ^{2}a+2\,\tan \left ( 1/2\,dx+c/2 \right ) b+a \right ) a}}-2\,{\frac{1}{bd \left ( \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) ^{2}a+2\,\tan \left ( 1/2\,dx+c/2 \right ) b+a \right ) }}+2\,{\frac{a}{d{b}^{2}\sqrt{{a}^{2}-{b}^{2}}}\arctan \left ( 1/2\,{\frac{2\,a\tan \left ( 1/2\,dx+c/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}}}} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.76553, size = 852, normalized size = 10.14 \begin{align*} \left [-\frac{2 \,{\left (a^{2} b - b^{3}\right )} d x \sin \left (d x + c\right ) + 2 \,{\left (a^{3} - a b^{2}\right )} d x +{\left (a b \sin \left (d x + c\right ) + a^{2}\right )} \sqrt{-a^{2} + b^{2}} \log \left (\frac{{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} + 2 \,{\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt{-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) + 2 \,{\left (a^{2} b - b^{3}\right )} \cos \left (d x + c\right )}{2 \,{\left ({\left (a^{2} b^{3} - b^{5}\right )} d \sin \left (d x + c\right ) +{\left (a^{3} b^{2} - a b^{4}\right )} d\right )}}, -\frac{{\left (a^{2} b - b^{3}\right )} d x \sin \left (d x + c\right ) +{\left (a^{3} - a b^{2}\right )} d x +{\left (a b \sin \left (d x + c\right ) + a^{2}\right )} \sqrt{a^{2} - b^{2}} \arctan \left (-\frac{a \sin \left (d x + c\right ) + b}{\sqrt{a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) +{\left (a^{2} b - b^{3}\right )} \cos \left (d x + c\right )}{{\left (a^{2} b^{3} - b^{5}\right )} d \sin \left (d x + c\right ) +{\left (a^{3} b^{2} - a b^{4}\right )} d}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.10802, size = 170, normalized size = 2.02 \begin{align*} \frac{\frac{2 \,{\left (\pi \left \lfloor \frac{d x + c}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (a\right ) + \arctan \left (\frac{a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + b}{\sqrt{a^{2} - b^{2}}}\right )\right )} a}{\sqrt{a^{2} - b^{2}} b^{2}} - \frac{d x + c}{b^{2}} - \frac{2 \,{\left (b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + a\right )}}{{\left (a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 2 \, b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + a\right )} a b}}{d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]